# 日志工具
import logging
from logging.handlers import RotatingFileHandler


def setup_logging():
    handler = RotatingFileHandler('app.log', maxBytes=1024 * 1024 * 10, backupCount=5)
    formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
    handler.setFormatter(formatter)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.addHandler(handler)
